package 集合框架.Set.课后作业.M3;

import java.util.Collection;

public class Student implements Comparable<Student> {
    private String name;
    private int age;
    private int score;

    public Student() {
    }

    public Student(String name, int age, int score) {
        this.name = name;
        this.age = age;
        this.score = score;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public int getScore() {
        return score;
    }

    public void setScore(int score) {
        this.score = score;
    }

    @Override
    public String toString() {
        return "Student{" +
                "name='" + name + '\'' +
                ", age=" + age +
                ", score=" + score +
                '}';
    }


    public int compareTo(Student o) {
        int num = this.score - o.score;
        int num1 = num ==0?o.age - this.age:num;
        return num1;
    }


/* public int compareTo(Student S) {
        int num =this.score -S.score;
        int num1 = num==0?S.age-this.age:num;
       return num1;
   }*/
}
